let fs = require('fs');
let buf = '';

process.stdin.on('readable', function() {
    let chunk = process.stdin.read();
    if (chunk) buf += chunk.toString();
});

process.stdin.on('end', function() {
    let input = buf.split("\n");
    let line = 0;
    let revs = function reverseString(str) {
        let reversed = '';
        for (let i = str.length - 1; i >= 0; i--) {
            reversed += str[i];
        }
        return reversed;
    };
    
    while (true) {
        let n = parseInt(input[line++]);
        if (n === 0) break;
        let s = [], minlen = 210;
        for (let i = 0; i < n; ++i) {
            s.push(revs(input[line++]));
            if (minlen > s[i].length) minlen = s[i].length;
        }
        // console.log(s);
        let res = "";
        for (let i = 0; i < minlen; ++i) {
            let flag = true;
            for (let j = 0; j < s.length - 1; ++j) {
                if (s[j][i] !== s[j+1][i]) {
                    flag = false;
                    break;
                }
            }
            if (flag === true) {
                res += s[0][i];
            }
            else {
                break;
            }
        }
        console.log(revs(res));
    }
});